@extends('layouts.app', ['activePage' => 'activity', 'titlePage' => __('活动管理')])

@section('content')
  <div class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <form method="post" action="{{ route('activities.store') }}" autocomplete="off" class="form-horizontal"
          enctype="multipart/form-data">
            @csrf
            @method('post')
            <div class="card ">
                <div class="card-header card-header-primary">
                    <h4 class="card-title">创建新活动</h4>
                    <p class="card-category"></p>
                </div>
                <div class="card-body ">
                    <div class="form-group">
                        <label for="title">主题</label>
                        <input type="text" class="form-control" id="title" placeholder="请输入活动标题" name="title" required  value="{{old('title')}}">
                        @if ($errors->has('title'))
                          <span id="name-error" class="error text-danger" for="title">至少输入3位字符</span>
                        @endif
                    </div>
                    <div class="form-group">
                      <label for="description">描述</label>
                      <input type="text" class="form-control" id="description" placeholder="在此输入活动内容及描述" name="description" value="{{old('description')}}">
                      @if ($errors->has('description'))
                        <span id="name-error" class="error text-danger" for="description">至少输入6位字符</span>
                      @endif
                  </div>
                    <div class="form-row">
                        <div class="form-group col-md-4">
                            <label class="label-control">报名截止时间</label>
                            <input type="datetime-local" class="form-control datetimepicker" min="2019-07-01T12:00:00" name="deadline"  required  value="{{old('deadline')}}"/>
                            @if ($errors->has('deadline'))
                              <span id="name-error" class="error text-danger" for="deadline">输入日期应在明天以后</span>
                            @endif
                        </div>
                        <div class="form-group col-md-4">
                            <label class="label-control">活动开始时间</label>
                            <input type="datetime-local" class="form-control datetimepicker" min="2019-07-01T12:00:00" name="start_time"  required  value="{{old('start_time')}}"/>
                            @if ($errors->has('start_time'))
                              <span id="name-error" class="error text-danger" for="start_time">输入日期应晚于报名截止时间</span>
                            @endif
                        </div>
                        <div class="form-group col-md-4">
                            <label class="label-control">活动结束时间</label>
                            <input type="datetime-local" class="form-control datetimepicker" min="2019-07-01T12:00:00" name="end_time"  required  value="{{old('end_time')}}"/>
                            @if ($errors->has('end_time'))
                              <span id="name-error" class="error text-danger" for="end_time">输入日期应晚于比赛开始时间</span>
                            @endif
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group col-md-6">
                            <label for="price">价格</label>
                            <input step="0.01" type="number" class="form-control" id="price" name="price" required value="{{old('price')}}">
                            @if ($errors->has('price'))
                              <span id="name-error" class="error text-danger" for="price">请输入大于等于0的数字</span>
                            @endif
                        </div>
                        <div class="form-group col-md-3">
                            <label for="location">地点</label>
                            <input type="text" class="form-control" id="location" placeholder="在此输入活动举办的地点" name="location" required  value="{{old('location')}}">
                            @if ($errors->has('location'))
                              <span id="name-error" class="error text-danger" for="location">请至少输入3位字符</span>
                            @endif
                        </div>
                        <div class="form-group col-md-2 ml-auto">
                            <div class="fileinput fileinput-new" data-name="imagefile" data-max-size="100"
                                data-provides="fileinput">
                              <span class="btn btn-raised btn-round btn-file">
                                <span class="fileinput-new">上传活动图片</span>
                                <span class="fileinput-exists">修改</span>
                                <input type="file" required accept="image/png">
                              </span>
                              <span class="fileinput-filename"></span>
                              <a href="#" class="close fileinput-exists" data-dismiss="fileinput"
                                style="float: none">&times;</a>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="card-footer ml-auto mr-auto">
                    <button type="submit" class="btn btn-primary">添加</button>
                </div>
            </div>

          </form>
        </div>
      </div>
    </div>
  </div>
@endsection
